def cache_deco(func):
    cache_dict = {}
    def wapper(x):
        if x not in cache_dict:
            cache_dict[x] = func(x)
        return cache_dict[x]
    return wapper


@cache_deco
def fib_1(n):
    a, b = 0, 1
    for _ in range(n):
        a, b = b, a + b
    return a


print(fib_1(3))